package service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import entity.LayRequest;
import entity.Log;
import mapper.LogMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author Administrator
 * @create 2020.06.20 上午 10:16
 */
@Service
public class LogServiceImpl implements LogService {
    @Autowired
    private LogMapper logMapper;
    @Override
    public boolean insert(Log log) {
        return logMapper.insert(log)>0?true : false;
    }

    @Override
    public PageInfo<Log> selectByMap(LayRequest layRequest) {
        PageHelper.startPage(layRequest.getPage(),layRequest.getLimit());
        List<Log> logs=logMapper.selectByMap(layRequest.getParams());
        return new PageInfo<>(logs);
    }

    @Override
    public void empty() {
        logMapper.empty();
    }
}
